<?php

class lib_pager {

    public $total_page;
    public $current_page;
    public $page_size;
    public $total_list;

    public function __construct($total_list, $page_size) {
        $this->total_list = $total_list;
        $this->page_size = $page_size;
        $this->total_page = ceil((count($total_list) / $page_size));
    }

    public function get_total_page() {
        return $this->total_page;
    }

    public function get_current_page_list($current_page) {
        $skip = ($current_page - 1) * $this->page_size; // skip = 0
        $current_list = array_slice($this->total_list, $skip, $this->page_size);
        return $current_list;
    }
}
